package org.lanqiao.oa.service;

import com.baomidou.mybatisplus.plugins.Page;
import com.sun.org.apache.xpath.internal.operations.Bool;
import org.apache.ibatis.annotations.Param;
import org.lanqiao.oa.mapper.PaginationCondition;
import org.lanqiao.oa.mapper.Role;
import org.lanqiao.oa.mapper.User;
import org.lanqiao.oa.vo.PermissionVo;

import java.util.List;
import java.util.Map;

public interface UserService {

    /**
     * 分页查询用户
     * @return
     */
    List<User> findByPage(Page page);

    /**
     * 新增用户
     * @param user
     * @return
     */
    Boolean saveUser(User user);

    /**
     * 根据id查询用户
     * @param id
     * @return
     */
    User selectById(String id);

    /**
     * 根据用户id查询权限
     * @param id
     * @return
     */
    List<PermissionVo> getUserPermissionById(String id);

    /**
     * 根据id删除用户
     * @param uid
     * @return
     */
    Boolean deleteUserByUid(String uid);

    /**
     * 修改用户
     * @param user
     * @return
     */
    Boolean updateUserById(User user);

    /**
     * 修改用户状态
     * @param uid
     * @param status
     * @return
     */
    Boolean updatelockStatus(String uid, Integer status);

    /**
     * 根据条件查询用户
     * @param condition
     * @return
     */
    PaginationCondition<User> selectUserByCondition(PaginationCondition condition);

    /**
     * 根据id获取用户的角色以及没有的额角色
     * @param id
     * @return
     */
    Map<String,List<Role>> getAssignRole(String id);

    /**
     * 给用分配权限
     * @param uid
     * @param rid
     * @return
     */
    Boolean assignRole(String uid,String rid);

    /**
     * 删除用户的权限
     * @param uid
     * @param rid
     * @return
     */
    Boolean unAssignRole(String uid,String rid);

    /**
     * 用户登录
     * @param user
     * @param ip
     * @return
     */
    User login(User user,String ip);
}
